package Junio2012;

import static org.junit.Assert.assertEquals;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class TestSopaDeLetras  {
	private SopaDeLetras s1, s2;

	/**
	 * Probando constructores
	 */
	@Before
	public void setUp() {
		char[][] letras ={ {'c','a','s','a'},
				{'p','e','r','a','l'},
				{'m','a','n','z','a','n','a'}
		};
		
		char[][] letras2 ={ {'c','a','r','l','o','s'},
				{'m','a','r','i','a'},
				{'f','e','d','e','r','i','c','o'}
		};
				
		s1 = new SopaDeLetras(letras);
		s2 = new SopaDeLetras(letras2);
	}

	@Test
	public void testS1() {
		assertEquals(0, s1.buscaPalabraEnFilas("casa")); 
		assertEquals(0, s1.buscaPalabraEnFilas("asac")); 
		assertEquals(1, s1.buscaPalabraEnFilas("peral")); 
		assertEquals(1, s1.buscaPalabraEnFilas("larep"));  
		assertEquals(2, s1.buscaPalabraEnFilas("manzana"));  
		assertEquals(2, s1.buscaPalabraEnFilas("anaznam"));  
		assertEquals(-1, s1.buscaPalabraEnFilas("prueba"));

	}
	
	@Test
	public void testS2() {
		assertEquals(0, s2.buscaPalabraEnFilas("carlos")); 
		assertEquals(0, s2.buscaPalabraEnFilas("solrac"));  
		assertEquals(1, s2.buscaPalabraEnFilas("maria"));  
		assertEquals(1, s2.buscaPalabraEnFilas("airam"));  
		assertEquals(2, s2.buscaPalabraEnFilas("federico"));  
		assertEquals(2, s2.buscaPalabraEnFilas("ociredef"));  
		assertEquals(-1, s2.buscaPalabraEnFilas("pepe"));
	}

	@After
	public void TearDown() {
		s1 = null;
		s2 = null;
	}
}
